package com.JavaBasic;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateDemo {
	public static void main(String[] args) throws ParseException {
		Date nowDate = new Date();
		Date d = new Date(1000);
		d.setTime(10000);
		
		System.out.println("当前时间:" + nowDate);
		System.out.println("指定1000时间戳的时间:" + d);
		System.out.println("获取当前时间的时间戳:" + nowDate.getTime());
		
		SimpleDateFormat dFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
		System.out.println("格式话以后当前时间:" + dFormat.format(nowDate));
		
		String dateString = "2018年08月08日 11:00:20";
		Date newDate = dFormat.parse(dateString);
		System.out.println(dateString + "转换成日期:" + newDate);
	}
}
